Data Structure


Q241.

Assume that the operators +, -, \times are left associative and \hat{} is right associative. The order of precedence (from highest to lowest) is \hat{}, \times, +, -. The postfix expression corresponding to the infix expression a+ b \times c-d \;\; \hat{} e \; \; \hat{} \; \; f is
GateOverflow

Q242.

The following postfix expression with single digit operands is evaluated using a stack:8 \ 2 \ 3 \ \;\hat{}\; / \ 2 \ 3 * + 5 \ 1 * -Note that \hat{}\; is the exponentiation operator. The top two elements of the stack after the first * is evaluated are
GateOverflow

Q243.

A single array A[1...MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top 2 (top1 \lt top 2) point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for "stack full" is
GateOverflow

Q244.

The following postfix expression with single digit operands is evaluated using a stack: 8 2 3 ^ / 2 3 * + 5 1 * - Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:
GateOverflow

Q245.

The expression 1 * 2 \wedge 3 * 4 \wedge 5 * 6 will be evaluated as
GateOverflow

Q246.

Which of the following is essential for converting an infix expression to the postfix form efficiently?
GateOverflow

Q247.

The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is
GateOverflow

Q248.

The infix expression A+(B-C)^*D is correctly represented in prefix notation as
GateOverflow

Q249.

Consider the following sequence of operations on an empty stack. push(54); push(52); pop(); push(55); push(62); s=pop(); Consider the following sequence of operations on an empty queue. enqueue(21); enqueue(24); dequeue(); enqueue(28); enqueue(32); q=dequeue(); The value of s+q is ___________.
GateOverflow

Q250.

A function f defined on stacks of integers satisfies the following properties. f(\emptyset) = 0 and f (push (S, i)) = max (f(S), 0) + i for all stacks S and integers i. If a stack S contains the integers 2, -3, 2, -1, 2 in order from bottom to top, what is f(S)?
GateOverflow